package com.lw.extraceim.loader;

import android.content.Context;
import android.view.SurfaceHolder;

import androidx.annotation.NonNull;

import com.lw.extraceim.app.AppConstants;
import com.lw.extraceim.loader.base.BaseLoader;
import com.lw.extraceim.model.PackageRoute;
import com.zhy.http.okhttp.callback.Callback;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author : liwei
 * @Email : 1759840027@qq.com
 * @Description :位置信息的加载类
 * @Date : 2019/5/14 20:33
 */
public class RouteLoader extends BaseLoader {

    public RouteLoader(Context context) {
        super(context);
    }

    /**
     * 上传位置信息
     * @param userId
     * @param x
     * @param y
     * @param callback
     */
    public void upload(Integer userId, double x, double y, @NonNull Callback callback){
        String url = AppConstants.ROUTE_SERVICE + "/save";
        Map<String,String> form = new HashMap<>();
        form.put("userId",userId + "");
        form.put("x",x + "");
        form.put("y",y + "");
        execute(url,AppConstants.GET,form,callback);
    }

    /**
     * 获取包裹的位置信息
     * @param packageId
     * @param callback
     */
    public void getPackageRoute(String packageId,@NonNull Callback callback){
        String url = AppConstants.ROUTE_SERVICE + "/getRouteList/package/" + packageId;
        execute(url,AppConstants.GET,null,callback);
    }

    /**
     * 获取快件的位置信息
     * @param esId
     * @param callback
     */
    public void getExpressSheetRoute(String esId,@NonNull Callback callback){
        String url = AppConstants.ROUTE_SERVICE + "/getRouteList/es/" + esId;
        execute(url,AppConstants.GET,null,callback);
    }


}
